import {IMock} from './i-mock';
import {MockConfigItem} from '../../entity/mock-config-item';

export class BooleanMock implements IMock {
    getBaseTypeMockConfigDisplay(mockConfigItem: MockConfigItem): string {
        switch (mockConfigItem.mockType) {
            case 0:
                return 'true';
            case 1:
                return 'false';
            case 2:
                return '@random([true,false])';
        }
        return mockConfigItem.value;
    }

    onSave(mockConfigItem: MockConfigItem): boolean {
        switch (mockConfigItem.mockType) {
            case 0:
                mockConfigItem.value = true;
                break;
            case 1:
                mockConfigItem.value = false;
                break;
            default:
                break;
        }
        return true;
    }
}
